from fastapi import APIRouter, Depends, HTTPException
from typing import Dict, Any

from app.models.schemas import ProcessingRequest
from app.services.content_service import generate_content_strategy  # 函数仅需2个参数
from app.clients.volcano_client import get_volcano_client  # 仅保留火山引擎客户端依赖

router = APIRouter()

@router.post("/video-outline-create", response_model=Dict[str, Any])
async def generate_content(
    request: ProcessingRequest,
    volcano_client = Depends(get_volcano_client)  # 只注入火山客户端，删除飞书客户端
):
    """生成内容策略主接口（修正参数数量不匹配问题）"""
    try:
        # 调用内容策略生成函数时，仅传入2个参数（与函数定义一致）
        result = await generate_content_strategy(
            request,  # 第一个参数：请求体
            volcano_client  # 第二个参数：火山引擎客户端
            # 移除feishu_client参数，因为generate_content_strategy不需要
        )
        return {
            "success": True,
            "data": result
        }
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))
